<?php
	include "../../public/commom/config.php";
	include "../../public/commom/commom.php";
?>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
		<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
		<link rel="stylesheet" type="text/css" href="../public/css/index.css"/>
	</head>

	<body>
		<div class="class-right">
			<?php
				if($_GET) {
					$class_id = $_GET["class_id"];
					
					$sql = "SELECT * FROM class WHERE id = '$class_id'";
					
					$result = mysqli_query($conn, $sql);
					
					while($row = mysqli_fetch_assoc($result)) {					
						$cname = $row["name"];
					}
				}
			?>
			<h5><?php echo $cname; ?></h5>
			<ul>
			<?php
				if($_GET) {
					$sql = "SELECT brand.*, class.name cname FROM brand LEFT JOIN class ON (brand.class_id = class.id) WHERE brand.class_id = '$class_id'";
				
					$result = mysqli_query($conn, $sql);
					
					while($row = mysqli_fetch_assoc($result)) {
						echo "<li>
								<a href='../brand.php?brand_id=" . $row["id"] . "' target='_top'><img src='" . $imgPath . $row["img"] . "'/></a>
								<h6>" . $row["name"] . "</h6>
							</li>";
					}
					
					mysqli_close($conn);
				}
			?>
			</ul>
		</div>
	</body>

</html>